<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>002 MySQL服务器的安装</title>
<link href="https://cdn.bootcdn.net/ajax/libs/video.js/8.2.1/video-js.min.css" rel="stylesheet">
<script src="https://cdn.bootcdn.net/ajax/libs/video.js/8.2.1/video.min.js"></script>
<!-- <script src="https://cdn.bootcdn.net/ajax/libs/videojs-contrib-hls/5.15.0/videojs-contrib-hls.min.js"></script> -->
<!-- videojs-contrib-hls 用于在电脑端播放 如果只需移动端播放可以不引入 -->
</head>
<body>
<style>
.video-js .vjs-tech {position: relative !important;}
/* fullscreen centered */
.video-js.vjs-fullscreen .vjs-tech {
position: absolute !important;
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
}

</style>
<div>
<video id="myVideo" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" data-setup='{}'
style='width: 100%;height: auto'>
<source id="source" src="https://taochen.synology.me:5337/Videos/fb94f75b55a0b83ba32d5099b1abae83/main.m3u8?api_key=d861eca044cd4b96a4658f5a068a0269" type="application/x-mpegURL">
</source>

</video>
</div>
</body>

<script>
var myVideo = videojs('myVideo', {
bigPlayButton: true,
textTrackDisplay: false,
posterImage: false,
errorDisplay: false,
})
myVideo.play()
var changeVideo = function(vdoSrc) {
if (/\.m3u8$/.test(vdoSrc)) {
myVideo.src({
src: vdoSrc,
type: 'application/x-mpegURL'
})
} else {
myVideo.src(vdoSrc)
}
myVideo.load();
myVideo.play();
}
</script>